// pages/abnormal/abnormal.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navTab: [{
      con: "偏高"
    },
    {
      con: "偏低"
    }
    ],
    current: 0,
    abnormal: {
      askArr: [
        { title: "遗传因素", con: "更舒适的范围和权威股份海报上色，是否会鼓起万分委屈俺姑，阿双方互为更好企鹅窝水电费华为。国际危机各部位发文件。", imgArr: ["https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png"] }
      ],
      riskArr: [
        { title: "遗传因素", con: "更舒适的范围和权威股份海报上色，是否会鼓起万分委屈俺姑，阿双方互为更好企鹅窝水电费华为。国际危机各部位发文件。", imgArr: ["https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png"] }
      ],
      doctorArr: [
        { title: "遗传因素", con: "更舒适的范围和权威股份海报上色，是否会鼓起万分委屈俺姑，阿双方互为更好企鹅窝水电费华为。国际危机各部位发文件。", imgArr: ["https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png"] }
      ],
      drugs: [
        { img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", title: "药品名字" },
        { img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", title: "药品名字" },
        { img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", title: "药品名字" },
        { img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", title: "药品名字" }
      ]
    },
    pageWrapCount: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    app.globalData.abnormal = that.data.abnormal
    that.setData({ pageWrapCount: that.data.pageWrapCount.concat([0]) })
  },
  //导航切换
  navTab: function (e) {
    var that = this
    console.log(e)
    if (that.removal(that.data.pageWrapCount, e.currentTarget.dataset.index)) {
      that.setData({ current: e.currentTarget.dataset.index })
    } else {
      that.setData({ pageWrapCount: that.data.pageWrapCount.concat([e.currentTarget.dataset.index]), current: e.currentTarget.dataset.index })
    }

  },
  //去重
  removal: function (arr, str) {
    for (var i = 0, len = arr.length; i < len; i++) {
      if (arr[i] == str) {
        return true
      }
    }
    return false
  },
  //药品详情
  drugsDetailClick: function (e) {
    console.log(e.detail.index)
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/drugs_detail/drugs_detail',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})